package cn.jilian.config;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.jdbc.core.JdbcTemplate;

import cn.jilian.dao.support.JdbcTemplateUsingUpperCaseKey;

@Configuration
@EnableJpaRepositories(basePackages= {"cn.jilian.dao"}) // JPA扫描该包路径下的Repositorie
@EntityScan(basePackages= {"cn.jilian.entity"}) 
@ComponentScan("cn.jilian.dao")
public class JPAConfig {

	@Autowired
	private DataSource dataSource;
	
	@Bean("upperCaseJdbcTemplate")
	public JdbcTemplate getUpperCaseJdbcTemplate() {
		JdbcTemplate jt= new JdbcTemplateUsingUpperCaseKey();
		jt.setDataSource(dataSource);
		return jt;
	}
	
	
}
